package cn.tedu.api.socket;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
    private ServerSocket serversocket;

    public Server(){
        System.out.println("服务端正在启动。。。");
        try {
            serversocket = new ServerSocket(9766);
            System.out.println("服务端启动完毕！！");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public void start(){
        System.out.println("等待客户端启动。。。");
        try {
            Socket socket = serversocket.accept();
            System.out.println("一个客户端已连接！！");
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
    public static void main(String[] args) {
        Server server = new Server();
        server.start();
    }
}
